/*
 * @Author: taoyuqing
 * @Date: 2022-12-22 23:50:03
 * @Description: 
 */
import 'dart:async';

import 'package:flutter/material.dart';
import 'dart:ui' as ui;
import '../../utils/utils.dart';
import 'game_group_title.dart';
import 'grid_imgs.dart';

class GameGroup extends StatefulWidget {
  final String iconPath;
  final String groupName;
  final List games;
  final Function? onTapRight;
  final Function? onTap;
  GameGroup(
      {Key? key,
      required this.iconPath,
      required this.groupName,
      required this.games,
      this.onTapRight, this.onTap})
      : super(key: key);

  @override
  State<GameGroup> createState() => _GameGroupState();
}

class _GameGroupState extends State<GameGroup> {
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        GameGroupTitle(
          titleUrl: widget.iconPath,
          titleName: widget.groupName,
          onTapRight: widget.onTapRight,
        ),
        Container(
          margin: EdgeInsets.only(top: 20),
          child: GridImgs(
            games: widget.games,
            ontap: (data){
              if (widget.onTap != null) {
                widget.onTap!(data);
              }
            },
          ),
        )
      ],
    );
  }
}
